Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
Download and install swissranger_camera
Description: This tutorial guides you through the process of downloading and installing all the software needed to run your Swissranger 3D Camera.Keywords: Swissranger, 3D camera, SR4000, SR3000, udev rules
Tutorial Level: BEGINNER
Download and install libmesasr
First of all you need to go to Mesa Imaging and download libmesasr since swissranger_camera depends on it to compile and work properly.
Go to http://www.mesa-imaging.ch/drivers.php and download the deb package for your architecture under Swissranger Linux Drivers.
At the time this tutorial was written the available drivers were:
After libmesasr finishes downloading install it.
Download swissranger_camera
Open a terminal window and cd into a directory that is on your ROS_PACKAGE_PATH.
Now you'll checkout the stack containing swissranger_camera using svn. In your terminal window run the following:
svn co https://code.ros.org/svn/ros-pkg/branches/trunk_cturtle/stacks/camera_drivers_experimental
Now all you need to do is rosmake swissranger_camera. If libmesasr was properly installed it should go smoothly.
rosmake swissranger_camera
Add udev rules
If you try to connect your Swissranger camera to your computer and run swissranger_camera and you get the following error...
[ERROR] 1279202609.670480000: Exception thrown while connecting to the camera: [SR::open]: Failed to open device!"
...then you need to edit your udev rules:
sudo gedit /etc/udev/rules.d/46-mesa.rules
You should see something like this:
BUS!="usb", SUBSYSTEM!=="usb_device", ACTION!="add", GOTO="kcontrol_rules_end" #Swissranger SR3k(old),SR3k,SR4k SYSFS{idVendor}=="0852", SYSFS{idProduct}=="0074", MODE="666", GROUP="usb" SYSFS{idVendor}=="1ad2", SYSFS{idProduct}=="0074", MODE="666", GROUP="usb" SYSFS{idVendor}=="1ad2", SYSFS{idProduct}=="0075", MODE="666", GROUP="usb" LABEL="kcontrol_rules_end"
All you have to do is add some extra lines and your file should end up looking like this:
BUS!="usb", SUBSYSTEM!=="usb_device", ACTION!="add", GOTO="kcontrol_rules_end" #Swissranger SR3k(old),SR3k,SR4k SYSFS{idVendor}=="0852", SYSFS{idProduct}=="0074", MODE="666", GROUP="usb" SYSFS{idVendor}=="1ad2", SYSFS{idProduct}=="0074", MODE="666", GROUP="usb" SYSFS{idVendor}=="1ad2", SYSFS{idProduct}=="0075", MODE="666", GROUP="usb" SUBSYSTEM=="usb", ACTION=="add", SYSFS{idVendor}=="0852", SYSFS{idProduct}=="0074", MODE="660", GROUP="plugdev" SUBSYSTEM=="usb", ACTION=="add", SYSFS{idVendor}=="1ad2", SYSFS{idProduct}=="0074", MODE="660", GROUP="plugdev" SUBSYSTEM=="usb", ACTION=="add", SYSFS{idVendor}=="1ad2", SYSFS{idProduct}=="0075", MODE="660", GROUP="plugdev" LABEL="kcontrol_rules_end"
Save and close the file. Plug your Swissranger camera to your computer and start swissranger_camera:
rosrun swissranger_camera swissranger_camera
Congratulations! You have successfully interfaced your Swissranger camera with ROS! You can start rviz to take a look at what it is publishing.
Credits
Thanks to David Dröschel for sharing how to change the udev rules.